home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / lib / H / tmp / libpq-fs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  4.2 KB  |  127 lines

  1. /* $Header: /private/postgres/src/lib/H/tmp/RCS/libpq-fs.h,v 1.10 1992/07/08 07:11:15 joey Exp $ */
  2.  
  3. #ifndef libpq_fs_H
  4. #define libpq_fs_H
  5.  
  6. #include "tmp/simplelists.h"
  7. #include <sys/file.h>
  8.  
  9. /* UNIX compatibility junk.  This should be in all system''s include files,
  10.    but this is not always the case. */
  11.  
  12. #define MAXNAMLEN 255
  13. struct pgdirent {
  14.     unsigned long d_ino;
  15.     unsigned short d_namlen;
  16.     char d_name[MAXNAMLEN+1];
  17. };
  18.  
  19. /* for lseek(2) */
  20. #ifndef SEEK_SET
  21. #define SEEK_SET 0
  22. #endif
  23.  
  24. /* for stat(2) */
  25. #ifndef S_IRUSR /* this not defined means rest are probably not defined */
  26. /* file modes */
  27.  
  28. #define S_IRWXU 00700           /* read, write, execute: owner */
  29. #define S_IRUSR 00400           /*  read permission: owner */
  30. #define S_IWUSR 00200           /*  write permission: owner */
  31. #define S_IXUSR 00100           /*  execute permission: owner */
  32.  
  33. #define S_IRWXG 00070           /* read, write, execute: group */
  34. #define S_IRGRP 00040           /*  read permission: group */
  35. #define S_IWGRP 00020           /*  write permission: group */
  36. #define S_IXGRP 00010           /*  execute permission: group */
  37.  
  38. #define S_IRWXO 00007           /* read, write, execute: other */
  39. #define S_IROTH 00004           /*  read permission: other */
  40. #define S_IWOTH 00002           /*  write permission: other */
  41. #define S_IXOTH 00001           /*  execute permission: other */
  42.  
  43. #define _S_IFMT  0170000        /* type of file; sync with S_IFMT */
  44. #define _S_IFBLK 0060000        /* block special; sync with S_IFBLK */
  45. #define _S_IFCHR 0020000        /* character special sync with S_IFCHR */
  46. #define _S_IFDIR 0040000        /* directory; sync with S_IFDIR */
  47. #define _S_IFIFO 0010000        /* FIFO - named pipe; sync with S_IFIFO */
  48. #define _S_IFREG 0100000        /* regular; sync with S_IFREG */
  49.  
  50. #undef S_IFDIR
  51. #undef S_IFREG
  52. #define S_IFDIR _S_IFDIR
  53. #define S_IFREG _S_IFREG
  54.  
  55. #define S_ISDIR( mode )         (((mode) & _S_IFMT) == _S_IFDIR)
  56.  
  57. #endif
  58.  
  59. /*
  60.  *  Flags for inversion file system large objects.  Normally, creat()
  61.  *  takes mode arguments, but we don't use them in inversion, since
  62.  *  you get postgres protections.  Instead, we use the low sixteen bits
  63.  *  of the integer mode argument to store the number of the storage
  64.  *  manager to be used, and the high sixteen bits for flags.
  65.  */
  66.  
  67. #define INV_SMGRMASK    0x0000ffff
  68. #define    INV_ARCHIVE    0x00010000
  69. #define    INV_WRITE    0x00020000
  70. #define    INV_READ    0x00040000
  71.  
  72. struct pgstat { /* just the fields we need from stat structure */
  73.     int st_ino;
  74.     int st_mode;
  75.     unsigned int st_size;
  76.     unsigned int st_sizehigh;    /* high order bits */
  77. /* 2^64 == 1.8 x 10^20 bytes */
  78.     int st_uid;
  79.     int st_atime;
  80.     int st_mtime;
  81.     int st_ctime;
  82. };
  83.  
  84. typedef struct Direntry_ {
  85.     struct pgdirent d;
  86.     SLNode Node;
  87. } Direntry;
  88.  
  89. typedef struct PDIR_ {
  90.     SLList dirlist;
  91.     Direntry *current_entry;
  92. } PDIR;
  93.  
  94. /* Error values for p_errno */
  95. #define PEPERM           1               /* Not owner */
  96. #define PENOENT          2               /* No such file or directory */
  97. #define PEACCES          13              /* Permission denied */
  98. #define PEEXIST          17              /* File exists */
  99. #define PENOTDIR         20              /* Not a directory*/
  100. #define PEISDIR          21              /* Is a directory */
  101. #define PEINVAL          22              /* Invalid argument */
  102. #define PENAMETOOLONG    63              /* File name too long */
  103. #define PENOTEMPTY       66              /* Directory not empty */
  104. #define PEPGIO           99              /* postgres backend had problems */
  105.  
  106. int p_open ARGS((char *fname , int mode ));
  107. int p_close ARGS((int fd ));
  108. int p_read ARGS((int fd , char *buf , int len ));
  109. int p_write ARGS((int fd , char *buf , int len ));
  110. int p_lseek ARGS((int fd , int offset , int whence ));
  111. int p_creat ARGS((char *path , int mode, int objtype ));
  112. int p_tell ARGS((int fd ));
  113. int p_mkdir ARGS((char *path , int mode ));
  114. int p_unlink ARGS((char *path ));
  115. int p_rmdir ARGS((char *path ));
  116. int p_ferror ARGS((int fd ));
  117. int p_rename ARGS((char *path , char *pathnew ));
  118. int p_stat ARGS((char *path , struct pgstat *statbuf ));
  119. PDIR *p_opendir ARGS((char *path ));
  120. struct pgdirent *p_readdir ARGS((PDIR *dirp ));
  121. void p_rewinddir ARGS((PDIR *dirp ));
  122. int p_closedir ARGS((PDIR *dirp ));
  123. int p_chdir ARGS((char *path ));
  124. char *p_getwd ARGS((char *path ));
  125.  
  126. #endif
  127.